<?php
require('includes/top.php');

$acc_id = $_POST['acc_id'];
$days = $_POST['days'];

$query = "SELECT * FROM accessories_rules WHERE accessories_id = ".$acc_id;
$result = mysql_query($query);
if ( mysql_num_rows ( $result )> 0 )
{
    header("location: accessories_rules.php?v=err");
}
else
 {
$sql1="INSERT INTO accessories_rules(`accessories_id`,`days`) VALUES ('$acc_id','$days')";
$result1=mysql_query($sql1);
}

if($result1>0)
{
header('Location: accessories_rules.php?v=success');
}
else
{
header('Location: accessories_rules.php?v=err');
}
?>